multi hot encode pandas column

36

s = df[column_to_encode].explode()
columns_list = list(df.columns)
columns_list.remove(column_to_encode)
df[column_list].join(pd.crosstab(s.index, s))

Comments

Submit
0 Comments